-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[evm] EIP-1153 enable transient storage feature #4214
Conversation
@@ -259,7 +259,7 @@ func TestConstantinople(t *testing.T) { | |||
}, | |||
{ | |||
"io1pcg2ja9krrhujpazswgz77ss46xgt88afqlk6y", | |||
1261440000, // = 200*365*24*3600/5, around 200 years later | |||
39275560, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it must less genesis default UpernavikBlockHeight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check past PR, you need to break it to 2 parts
after Tsunami - Upernavik {
}
after Upernavik {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix now
function tload(uint location) public view returns (uint value) { | ||
assembly { | ||
value := tload(location) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transient storage is accessible to smart contracts via 2 new opcodes, TLOAD
and TSTORE
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4214 +/- ##
==========================================
+ Coverage 76.51% 76.75% +0.24%
==========================================
Files 340 340
Lines 29273 29314 +41
==========================================
+ Hits 22397 22501 +104
+ Misses 5761 5707 -54
+ Partials 1115 1106 -9 ☔ View full report in Codecov by Sentry. |
@@ -530,6 +544,8 @@ func (stateDB *StateDBAdapter) Prepare(rules params.Rules, sender, coinbase comm | |||
if !rules.IsBerlin { | |||
return | |||
} | |||
// Clear out any leftover from previous executions | |||
stateDB.accessList = newAccessList() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not necessary? we are creating a new StateDBAdpator
for each tx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for safety, it's best to add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the relationship with eip-1153?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for safety, it's best to add
for what kind of safety? We need to be clear what we want to achieve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code has updated in
https://github.com/ethereum/go-ethereum/pull/26003/files#diff-c3757dc9e9d868f63bc84a0cc67159c1d5c22cc5d8c9468757098f0492e0658cR1073-R1074
i think we missed it
@@ -547,6 +563,8 @@ func (stateDB *StateDBAdapter) Prepare(rules params.Rules, sender, coinbase comm | |||
if rules.IsShanghai { // EIP-3651: warm coinbase | |||
stateDB.AddAddressToAccessList(coinbase) | |||
} | |||
// Reset transient storage at the beginning of transaction execution | |||
stateDB.transientStorage = newTransientStorage() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing, not necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is best to add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as discused, let's remove this, it is done in NewStateDBAdapter
@@ -356,7 +356,8 @@ func TestConstantinople(t *testing.T) { | |||
require.Equal(isSumatra, chainRules.IsShanghai) | |||
|
|||
// Cancun, Prague not yet enabled | |||
require.False(evmChainConfig.IsCancun(big.NewInt(int64(e.height)), evm.Context.Time)) | |||
isUpernavik := g.IsUpernavik(e.height) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments need updates
sn := state.Snapshot() | ||
state.SetTransientState(addr, key, value) | ||
// the retrieved value should equal what was set | ||
if got := state.GetTransientState(addr, key); got != value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's be consistent with testing code style, use require.Equal(value, got)
// value is now the empty hash | ||
state.RevertToSnapshot(sn) | ||
if got, exp := state.GetTransientState(addr, key), (common.Hash{}); exp != got { | ||
t.Fatalf("transient storage mismatch: have %x, want %x", got, exp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, use current testing code style
t.Fatalf("transient storage mismatch: have %x, want %x", got, value) | ||
// reset transient state | ||
state.SetTransientState(addr, key, value) | ||
if got := state.GetTransientState(addr, key); got != value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
@@ -677,6 +704,7 @@ func TestSnapshotRevertAndCommit(t *testing.T) { | |||
// refund fix and accessList are introduced after fixSnapshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update comment, add transient storage
@@ -701,7 +701,7 @@ func TestSnapshotRevertAndCommit(t *testing.T) { | |||
require.Equal(3, len(stateDB.contractSnapshot)) | |||
require.Equal(3, len(stateDB.selfDestructedSnapshot)) | |||
require.Equal(3, len(stateDB.preimageSnapshot)) | |||
// refund fix and accessList are introduced after fixSnapshot | |||
// refund fix and accessList、transient storage are introduced after fixSnapshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems a chinese version comma
"rawReturnValue": "0000000000000000000000000000000000000000000000000000000000000003", | ||
"comment": "call getAddress" | ||
}] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add newline
@@ -701,7 +701,7 @@ func TestSnapshotRevertAndCommit(t *testing.T) { | |||
require.Equal(3, len(stateDB.contractSnapshot)) | |||
require.Equal(3, len(stateDB.selfDestructedSnapshot)) | |||
require.Equal(3, len(stateDB.preimageSnapshot)) | |||
// refund fix and accessList、transient storage are introduced after fixSnapshot | |||
// refund fix and accessList,transient storage are introduced after fixSnapshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refund fix, accessList, and transient
@@ -257,6 +257,16 @@ func TestConstantinople(t *testing.T) { | |||
action.EmptyAddress, | |||
29275561, | |||
}, | |||
// after Tsunami - Upernavik | |||
{ | |||
action.EmptyAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be "io1pcg2ja9krrhujpazswgz77ss46xgt88afqlk6y"
@@ -257,6 +257,16 @@ func TestConstantinople(t *testing.T) { | |||
action.EmptyAddress, | |||
29275561, | |||
}, | |||
// after Tsunami - Upernavik |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this comment line should be at L255
Quality Gate failedFailed conditions |
Description
Implemented EIP-1153
Fixes #4177
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: